package de.fhb.equakecamel;

import java.util.Date;

public class EarthQuakeObject {
	
	private Date date;
	private String stringDate, orgXML, area, location;
	private String windSpeedInKmph, windDirection, weatherDesc, tempMinC, tempMaxC;
	private double magnitude, latitude, longitude;
	
	public EarthQuakeObject(String _location, String _date, double _magnitude, double _latitude, double _longitude, String _area, String _windSpeedInKmph, String _windDirection, String _weatherDesc, String _tempMinC, String _tempMaxC, String _orgXML){
		location = _location;
		stringDate = _date;
		date = createDate(_date);
		area = _area;
		magnitude = _magnitude;
		latitude = _latitude;
		longitude = _longitude;
		windSpeedInKmph = _windSpeedInKmph;
		windDirection = _windDirection;
		weatherDesc = _weatherDesc;
		tempMinC = _tempMinC;
		tempMaxC = _tempMaxC;
		orgXML = _orgXML;
	}
	
	@SuppressWarnings("deprecation")
	private Date createDate(String _date) {
		int jahr = Integer.parseInt(_date.substring(0, 4));
		int monat = Integer.parseInt(_date.substring(5, 7));
		int tag = Integer.parseInt(_date.substring(8, 10));
		int stunde = Integer.parseInt(_date.substring(11, 13));
		int minute = Integer.parseInt(_date.substring(14, 16));
		int sekunde = Integer.parseInt(_date.substring(17, 19));
		Date date = new Date(jahr, monat, tag, stunde, minute,sekunde);
		date.setMonth(date.getMonth()-1); //workaround
		date.setYear(date.getYear()-1900); // geht nicht anders
		return date;
	}
	
	public String getLocation(){
		return location;
	}

	public String getStringDate(){
		return stringDate;
	}

	public Date getDate() {
		return date;
	}

	public String getArea() {
		return area;
	}

	public double getMagnitude() {
		return magnitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}
	
	public String getWindSpeedInKmph() {
		return windSpeedInKmph;
	}

	public String getWindDirection() {
		return windDirection;
	}

	public String getWeatherDesc() {
		return weatherDesc;
	}

	public String getTempMinC() {
		return tempMinC;
	}

	public String getTempMaxC() {
		return tempMaxC;
	}

	public String getOrgXML(){
		return orgXML;
	}
}
